<template>
  <Tab />
  <div class="container">
    <div class="content">
      <!-- 加载数值 -->
      <div class="num">
        <span>{{ outputValue.toFixed(0) }}%</span>
        <span>AI正在为您购买最佳机票…</span>
      </div>

      <div class="progress">
        <el-progress :percentage="percentage" :text-inside="true">
          <template #default>
            <img src="../../static/img/progressAir.png" alt="" />
          </template>
        </el-progress>
      </div>
    </div>
  </div>
</template>
<script setup>
import { ref } from "vue";
import { useTransition } from "@vueuse/core";
import { useRouter } from "vue-router";
import { uni } from "@dcloudio/uni-h5";
const router = useRouter();

const source = ref(0);
const outputValue = useTransition(source, {
  duration: 500,
});

// 数据绑定
const percentage = ref(0); // 进度值

setTimeout(() => {
  percentage.value = 100;
  source.value = 100;
}, 1000);
setTimeout(() => {
  uni.navigateTo({
    url: '/pages/choice/index'
  })
}, 2000);
</script>
<style scoped lang="scss">
.container {
  background-size: cover; /* 背景图覆盖整个元素 */
 // background-position: center; /* 背景图居中 */
  height: 100dvh; /* 高度设置为100%，根据实际情况调整 */
  width: 100dvw; /* 宽度设置为100%，根据实际情况调整 */
  position: fixed; /* 定位为固定，使得背景图覆盖整个页面 */
  top: 0;
  left: 0;
  // z-index: - 1;  /* 确保背景在其他内容之下 */
  background-image: url("../../static/img/background2.png");

  .content {
    width: 664rpx;
    // height: 920rpx;
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    // border: 1px solid red;
    display: flex;
    flex-direction: column;
    align-items: center;

    .num {
      display: flex;
      flex-direction: column;
      align-items: center;
      & > :nth-child(1) {
        // width: 280rpx;
        // height: 120rpx;
        font-family: Gotham, Gotham;
        font-weight: bold;
        font-size: 120rpx;
        color: #000000;
        line-height: 120rpx;
        text-align: center;
        font-style: normal;
        background: linear-gradient(
          0deg,
          #2d94ff 0%,
          #4414f2 48%,
          #ff5e99 100%
        );
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }

      & > :nth-child(2) {
        width: 382rpx;
        height: 32rpx;
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 32rpx;
        color: #252525;
        line-height: 32rpx;
        text-align: center;
        font-style: normal;
        margin-top: 10px;
      }
    }

    .progress {
      width: 666rpx;
      margin-top: 40rpx;
      img {
        width: 76rpx;
        height: 68rpx;
      }
    }
  }
}
:deep(.el-progress) {
  .el-progress-bar__outer {
    // background: rgba(255, 168, 0, 0.16);
    border: 1px solid #dde2ea;
    border-radius: 7px;
    height: 10rpx !important;
    position: absolute;
    left: 0;
    right: 0;
    z-index: 1;
    overflow: visible; // 关键
  }
  .el-progress-bar__inner {
    position: absolute;
    height: 10rpx;
    background-color: #005ff9;
    &::after {
      display: block;
    }
  }
  .el-progress-bar__innerText {
    display: block;
    float: right;
    background-size: 100% 100%;
    margin: -25rpx 0rpx;
    position: absolute;
    right: -9rpx;
    font-size: 0;
  }
}
</style>
